package com.study.lambda;

interface PersonFactory<P extends Person> {
    /**
     * @param firstName
     * @param lastName
     * @return
     */
    P create(String firstName,String lastName);
}
/**
 * @author geticsen
 */
public class Person {
    String firstName;
    String lastName;

    Person() {}

    Person(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }

    public static void main(String[] args) {
        PersonFactory<Person> personPersonFactory = Person::new;
        Person person = personPersonFactory.create("aaa", "bbb");

        System.out.println("person = " + person);

    }

    @Override
    public String toString() {
        return "Person{" +
                "firstName='" + firstName + '\'' +
                ", lastName='" + lastName + '\'' +
                '}';
    }
}